//
//  UIView+ScreenImage.m
//  NoneCar
//
//  Created by DongSen on 2018/7/11.
//  Copyright © 2018年 董森森. All rights reserved.
//

#import "UIView+ScreenImage.h"

@implementation UIView (ScreenImage)
- (UIImage *)imageByRenderingView{
    CGFloat oldAlpha = self.alpha;
    self.alpha = 1;
    UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0);
    [self.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    self.alpha = oldAlpha;
    return resultingImage;
}
@end
